/**
 * 常用工具
 */
define(function(){
	return {
		/**
		 * 继承方法
		 * @param {Function} ctor		构造函数
		 * @param {Function} superCtor 	父类的构造函数
		 */
		inherits : function(ctor, superCtor){
			if (typeof Object.create === 'function') {
				ctor.super_ = superCtor
			    ctor.prototype = Object.create(superCtor.prototype, {
			    	constructor: {
			    		value: ctor,
			    		enumerable: false,
			    		writable: true,
			    		configurable: true
			      	}
			    });
			}else{
				ctor.super_ = superCtor
			    var TempCtor = function () {}
			    TempCtor.prototype = superCtor.prototype
			    ctor.prototype = new TempCtor()
			    ctor.prototype.constructor = ctor
			}
		},
		/**
		 * 克隆
		 * @param {Object} obj 要克隆的对象
		 */
		clone : function(obj){
    		var o, obj;
		    if (obj.constructor == Object){
		        o = new obj.constructor();
		    }else{
		        o = new obj.constructor(obj.valueOf());
		    }
		    for(var key in obj){
		        if ( o[key] != obj[key] ){
		            if ( typeof(obj[key]) == 'object' ){
		                o[key] = clone(obj[key]);
		            }else{
		                o[key] = obj[key];
		            }
		        }
		    }
		    o.toString = obj.toString;
		    o.valueOf = obj.valueOf;
		    return o;
		}
	};
});